package com.sunjob.mroresumeproject.dao;

import com.sunjob.common.domain.mroresume.BusAction;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository//声明持久层
public interface BusActionMapper {

    @Select("select busid,bustypes,management,busstate,indate from bus_useresume where busid=#{busid} and status=1")
    @Results({
            @Result(property = "busid",column = "busid"),
            @Result(property = "bustypes",column = "bustypes"),
            @Result(property = "management",column = "management"),
            @Result(property = "busstate",column = "busstate"),
            @Result(property = "indate",column = "indate")

    })
    List<BusAction> queryBusAction2(String busid);




    @Select("select count(*) from bus_useresume where status=1 ")
    int querycount();

    @Select("select * from bus_useresume where status=1 limit #{pages},#{size} ")
    List<BusAction> queryBusAction(int pages, int size);

    @Insert("insert into bus_useresume values(#{busid},#{bustypes},#{brand},#{busproduce},#{buskilometers},#{management},#{post},#{busstate},#{busremarks},#{indate},#{status})")
    void insertBusAction(BusAction busAction);



    @Select("select busid,bustypes,brand,busproduce,buskilometers,management,post,busstate,busremarks,indate from bus_useresume where busid=#{busid} and status=1")
    @Results({
            @Result(property = "busid",column = "busid"),
            @Result(property = "bustypes",column = "bustypes"),
            @Result(property = "brand",column = "brand"),
            @Result(property = "busproduce",column = "busproduce"),
            @Result(property = "buskilometers",column = "buskilometers"),
            @Result(property = "management",column = "management"),
            @Result(property = "post",column = "post"),
            @Result(property = "busstate",column = "busstate"),
            @Result(property = "busremarks",column = "busremarks"),
            @Result(property = "indate",column = "indate"),

    })
    List<BusAction> queryBusActionone(Long busid);


    @Update("update bus_useresume set statues=0 where busid=#{busid}")
    void deleteBusAction(String busid);

    @Update("update bus_useresume set bustypes=#{bustypes},busproduce=#{busproduce},buskilometers=#{buskilometers},management=#{management},post=#{post},busstate=#{busstate},busremarks=#{busremarks},indate=#{indate} where busid=#{busid}")
    void updateBusAction(BusAction busAction);

    @Update("update bus_useresume set statues=0 where busid=#{s}")
    void deleteBusActionone(String s);
}
